import { createBrowserRouter, Navigate } from "react-router-dom";
import App from "../App";
import Home from "../pages/Home/Home";
import Demo from "../pages/Home/Demo.jsx";
import Type from "../pages/Type/Cate.jsx";
import My from "../pages/My/My";
import Search from "../pages//Home/Search";
import Cars from "../pages/Cars/Cars";
import MyToBePaid from "../pages/My/MyToBePaid"; //待支付
import MyToBeShipped from "../pages/My/MyToBeShipped"; //待发货
import MyRefundService from "../pages/My/MyRefundService";
import MyToBeEvaluated from "../pages/My/MyToBeEvaluated";
import MyToBeReceived from "../pages/My/MyToBeReceived"; //待收货
import MySetting from "../pages/My/MySetting";
import MyAllOrderGoods from "../pages/My/MyAllOrderGoods"; //全部订单父组件
import MyAllOrder from "../pages/My/MyAllOrder.jsx";//全部订单子组件
import MyCollect from "../pages/My/MyCollect";
import Mycompleted from "../pages/My/Mycompleted.jsx";//已完成

const router = createBrowserRouter([
    {
        path: "/",
        element: <App></App>,
        children: [
            { path: "/", element: <Navigate to="/Home" /> },
            { path: "/Home", element: <Home /> },

            { path: "/Type", element: <Type /> },
            { path: "/cars", element: <Cars /> },
            { path: "/My", element: <My /> },
        ],
    },
    { path: "/demo", element: <Demo></Demo> },
    { path: "/search", element: <Search /> },
    { path: "/RefundService", element: <MyRefundService /> },
    { path: "/ToBeEvaluated", element: <MyToBeEvaluated /> },
    { path: "/ToSetting", element: <MySetting /> },
    {
        path: "/ToAllOrderGoods",
        element: <MyAllOrderGoods />,
        children: [
            { path: "/ToAllOrderGoods", element: <Navigate to="/ToAllOrderGoods/ToAllOrder" /> },
              { path: "/ToAllOrderGoods/ToAllOrder", element: <MyAllOrder /> }, //全部订单子组件
            { path: "/ToAllOrderGoods/ToBePaid", element: <MyToBePaid /> }, //待支付
            { path: "/ToAllOrderGoods/ToBeShipped", element: <MyToBeShipped /> }, //待发货
            { path: "/ToAllOrderGoods/ToBeReceived", element: <MyToBeReceived /> }, //待收货
            { path: "/ToAllOrderGoods/ToBeEvaluated", element: <MyToBeEvaluated /> }, //待评价
            { path: "/ToAllOrderGoods/MyCompleted", element: <Mycompleted /> }, //已完成
        ],

    },
    { path: "/ToCollect", element: <MyCollect /> },
]);
export default router;
